"""
23 - Dars
"""
D = {}
PRODUCT1 = {'title': 'Sony', 'price': 100}
PRODUCT2 = dict(title='iPhone', price=110)

USERS = [
    ['bob@gmail.com', 'Bob'],
    ['katy@gmail.com', 'Katy'],
    ['john@gmail.com', 'John']
]
D_USERS = dict(USERS)
print(USERS)
print(D_USERS)

USERS_T = (
    ('bob@gmail.com', 'Bob'),
    ('katy@gmail.com', 'Katy'),
    ('john@gmail.com', 'John')
)
T_USERS = dict(USERS_T)
print(USERS_T)
print(T_USERS)

print(D)
print(PRODUCT1)
print(PRODUCT2)

PRODUCT3 = dict.fromkeys(['price1', 'price2', 'price3'], 50)
print(PRODUCT3)

NUMS = {i: i ** 2  for i in range(1, 10)}
print(NUMS)

PRODUCT1 = {'title': 'Sony', 'price': 100}
PRODUCT2 = dict(title='iPhone', price=110)

print(PRODUCT1['title'])
print(PRODUCT2.get('title', 'NO')) # if no key

print(NUMS[5]) # error
print(NUMS[3]) # OK

# for key in PRODUCT1:
#    print(f'{key}: {PRODUCT1[key]}')

for key, value in PRODUCT1.items():
    print(key, value)

PRODUCTS = [
    {'title': 'Sony', 'price': 100},
    {'title': 'iPhone', 'price': 110},
    {'title': 'Samsung', 'price': 90}
]

print(PRODUCTS)

for PRODUCT in PRODUCTS:
    print(PRODUCT['title'], PRODUCT['price'])
